

class Skill(object):
    """
    Represents a skill a Skilled object might have
    """
    #Identifiers
    name = ""
    description = ""
    id = ""
    
    def modifies(self, var):
        """
        Returns True if this skill modifies the specified variable ID.
        """
        raise NotImplementedError
    
    def modify(self, var, value):
        """
        Returns a new value for the variable specified, given the original value.
        """
        raise NotImplementedError
    

class Skilled(object):
    """
    An object that has skills. Example: Special Pirates
    """
    skills = []
    
    def applySkills(self, var, value):
        """
        Applies this object's skills to the variable, given the original value.
        """
        for s in self.skills:
            if s.modifies(var):
                value = s.modify(var, value)
        return value
    
    def hasSkill(self, id):
        """
        Returns True if this object has the skill specified by the skill ID.
        """
        for s in self.skills:
            if s.id == id:
                return True
        return False
    
